package com.hqd.test.xml.custom;

import com.hqd.ch03.v7.config.BeanDefinition;
import com.hqd.ch03.v7.reader.xml.parse.BeanDefinitionParser;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class RootBeanDefinitionParser implements BeanDefinitionParser {

    @Override
    public BeanDefinition parse(Element element) {
        NodeList childNodes = element.getChildNodes();
        UserBeanDefinitionParser parser = new UserBeanDefinitionParser();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item instanceof Element && item.getLocalName().equals("user")) {
                //  BeanDefinition bd = parser.parse((Element) item, parserContext);
                //  parserContext.getRegistry().registerBeanDefinition("user", bd);
            }
        }
        return null;
    }
}
